// *************************************************************************************************
//
// MK3D Engine
// --------------------------------------
// Copyright (C) 2007-2011 Zeb (mailto: zebbey@gmail.com)
//
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
//
// *************************************************************************************************

#ifndef __H_MK_SHADER__
#define __H_MK_SHADER__

#include "mk_texture.h"
#include "mk_resource.h"

namespace MK3DE
{
	//! constant define.
	const char SCN_MAT_WORLD[] = "MAT_WORLD";
	const char SCN_MAT_VIEW[] = "MAT_VIEW";
	const char SCN_MAT_PROJ[] = "MAT_PROJ";
	const char SCN_MAT_WORLD_VIEW[] = "MAT_WORLD_VIEW";
	const char SCN_MAT_WORLD_VIEW_PROJ[] = "MAT_WORLD_VIEW_PROJ";
	const char SCN_MAT_PROJ_TEXTURE[] = "MAT_PROJ_TEXTURE";
	const char SCN_MAT_LIGHT_WORLD_VIEW_PROJ[] = "MAT_LIGHT_WORLD_VIEW_PROJ";
	const char SCN_MAT_BONE_PALETTE[] = "MAT_BONE_PALETTE";
	const char SCN_MAT_SHADOW_MAT_WRAP[] = "MAT_SHADOW_MAP_WRAP";

	const char SCN_AMBIENT_LIGHT_COLOR[] = "ambientLight";
	const char SCN_DIFFUSE_LIGHT_COLOR[] = "diffuseLight";
	const char SCN_SPECULAR_LIGHT_COLOR[] = "specularLight";
	const char SCN_SHININESS[] = "SHININESS";
	const char SCN_EYS_POS[] = "eyePos";
	const char SCN_LIGHT_DIRECTION[] = "lightDirection";

	const char SCN_FOG_START[] = "fogStart";
	const char SCN_FOG_END[] = "fogEnd";
	const char SCN_FOG_COLOR[] = "fogColor";

	const char SCN_SHADOW_MAP_TEXTURE[] = "TEX_SHADOW_MAP";

	const char SCN_SKY_BOX_TEXTURE[] = "skyBoxTexture";
	const char SCN_REFLECTION_TEXTURE[] = "texReflection";
	const char SCN_REFRACTION_TEXTURE[] = "texRefraction";
	const char SCN_WATER_BUMP_TEXTURE[] = "texWaterBump";
	const char SCN_WATER_BUMP_FACTOR[] = "bumpFactor";

	//! technique define.
	const char TECH_MODEL_NORMAL[] = "MODEL_NORMAL";
	const char TECH_MODEL_NORMAL_CAST_SHADOW[] = "MODEL_NORMAL_CAST_SHADOW";
	const char TECH_MODEL_NORMAL_RECV_SHADOW[] = "modelRecvShadow";
	const char TECH_MODEL_SKIN[] = "MODEL_SKIN";
	const char TECH_MODEL_SKIN_CAST_SHADOW[] = "MODEL_SKIN_CAST_SHADOW";
	const char TECH_MODEL_SKIN_RECV_SHADOW[] = "modelSkinRecvShadow";

	const char TECH_TERRAIN_LAYER_1[] = "TERRAIN_LAYER1";
	const char TECH_TERRAIN_LAYER_2[] = "TERRAIN_LAYER2";
	const char TECH_TERRAIN_LAYER_3[] = "TERRAIN_LAYER3";
	const char TECH_TERRAIN_LAYER_4[] = "TERRAIN_LAYER4";

	const char TECH_TERRAIN_FOG_LAYER1[] = "TERRAIN_FOG_LAYER1";
	const char TECH_TERRAIN_FOG_LAYER2[] = "TERRAIN_FOG_LAYER2";
	const char TECH_TERRAIN_FOG_LAYER3[] = "TERRAIN_FOG_LAYER3";
	const char TECH_TERRAIN_FOG_LAYER4[] = "TERRAIN_FOG_LAYER4";

	const char TECH_TERRAIN_SKY_BOX[] = "skyBox";
	const char TECH_TERRAIN_SHADOW[] = "terrainShadow";

	const char TECH_WATER_NORMAL[] = "waterNormal";

	class MK3DE_API CShader : public CResource
	{
	public:
		CShader() {}
		CShader(const char* fileName) : CResource(fileName) {}
		~CShader() {}

		RESOURCE_TYPE GetType() { return RES_T_SHADER; }

		virtual BOOL TechniqueBegin(const char* techName, DWORD& passNum) = 0;
		virtual BOOL PassBegin(DWORD idx) = 0;
		virtual BOOL PassEnd() = 0;
		virtual BOOL TechniqueEnd() = 0;

		virtual BOOL SetFloatArray(const char* name, float* value, DWORD count) = 0;
		virtual BOOL SetMatrix(const char* name, const D3DXMATRIX* mat) = 0;
		virtual BOOL SetTexture(const char* name, CTexture2D* texture) = 0;
		virtual BOOL SetTexture(const char* name, CTexture3D* texture) = 0;
	};
};

#endif // __H_MK_SHADER__